Masthead

Converting Dates with Functions

The code we are writing to do conversions may be used over and over with different files. Because of this we want to put the code into a function so we can access it whenever it is needed.

"""
* This function converts database dates to a nicer format.
* 
* Inputs:
*  TheComputerDate - the date in standard database format YYYY-MM-DD
* Outputs:
*  TheNiceDate - a date that is better for humans.
"""
def ComputerDateToNiceDate(TheComputerDate):

	# Add code from previous webpage here
	
	return(TheNiceDate)

 

Additional Resources

Python Documentation: String functions

Python Documentation: Defining Functions

 

© Copyright 2018 HSU - All rights reserved.